<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">

        <xsl:choose>
            <xsl:when test="count(//product) = 0">
               Pas de produit !!
            </xsl:when>
            <xsl:otherwise>

                <table class="listeComptes">
                    <tr>
                        <td>
                            <b>Nom produit</b>
                        </td>
                        <td>
                            <b>Description</b>
                        </td>
                        <td>
                            <b>Catégorie</b>
                        </td>
                        <td>
                            <b>Actions</b>
                        </td>
                    </tr>

                    <xsl:for-each select="//product">
                        <tr>
                            <td>
                               <xsl:value-of select="name" />
                            </td>
                            <td>
                               <xsl:value-of select="description" />
                            </td>
                            <td>
                               <xsl:value-of select="category" />
                            </td>
                            <td>
                                <a style="padding:9px;" href="{concat('../secured/ProductMgt.do?id=', @id)}">
                                    <img border="0" src="../images/edit.gif"></img>
                                </a>
                                <a style="padding:9px;" href="{concat('../secured/RemoveProduct.do?id=', @id)}">
                                    <img border="0" src="../images/delete.gif"></img>
                                </a>
                            </td>
                        </tr>
                    </xsl:for-each>
                </table>
            </xsl:otherwise>
        </xsl:choose>
        
    </xsl:template>
</xsl:stylesheet>